package thread.thread_04_27.impl_timer;

import javafx.concurrent.Task;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author bruin_du
 * @description 主方法
 * @date 2022/5/7 17:46
 **/
public class Main {
    public static void main(String[] args) {
        MyTimerTask t1 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("5s 之后");
            }
        };

        MyTimerTask t2 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("4s 之后");
            }
        };

        MyTimerTask t3 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("3s 之后");
            }
        };

        MyTimerTask t4 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("2s 之后");
            }
        };

        MyTimerTask t5 = new MyTimerTask() {
            @Override
            public void run() {
                System.out.println("1s 之后");
            }
        };

        MyTimer myTimer = new MyTimer();
//        myTimer.schedule(t1, 5000);
//        myTimer.schedule(t2, 4000);
//        myTimer.schedule(t3, 3000);
//        myTimer.schedule(t4, 2000);
//        myTimer.schedule(t5, 1000);
    }
}
